# Python-based preprocessing (using the pandas library)
import pandas as pd

# Load the CSV data and assign spatial coordinates
df = pd.read_csv(‘data.csv’)
df['GridID'] = range(1, len(df)+1)  # Create unique raster IDs
df.to_csv('mu_values_indexed.csv', index=False)

# ArcGIS Pro Python Window code
arcpy.management.JoinField 
    (in_data="watershed_grid",
    in_field="GridID",          # Unique raster ID  
    join_table="mu_values_indexed.csv",
    join_field="GridID",        # Matching ID in the CSV file  
    fields="mu"                 # μ value field to be assigned)

# Convert vector to raster  
arcpy.conversion.PolygonToRaster(
    in_features="watershed_grid",
    value_field="mu",           # Field containing μ values
    out_rasterdataset="mu_surface.tif",
    cellsize=10,
    build_rat="BUILD")

